﻿// JScript 文件

function PanelItem() 
{       
    //已下载的内容
    this.AddPanelItem = function(self, FileInfo, DiryList)
    {
        var divFile = document.createElement("div");
        divFile.className="divFile";
        
        var divImage = document.createElement("div");
        divImage.id="div_" + FileInfo.ID;
        divImage.className="divImage";
        
        //图片
        var ImgPath = "/AspxPath/UploadFiles" + DiryList.Path + "/" + FileInfo.Name;
        ImgPath = ImgPath.replace(/(\\)/g,"/");
        var strImgPath = "../../.." + ImgPath;
        var img = document.createElement("img");
        img.id="img_" + FileInfo.ID;
        img.src= strImgPath;
        img.alt= FileInfo.Name;
        img.onload = function()
        {
            resizeImage(this, 134, 100);
        };
        img.onclick = function()
        {
            window.open(this.src);
        };
        
        //divImage.innerHTML = '<img src="'+strImgPath+'" id="img_'+FileInfo.ID+'" alt="'+FileInfo.Name+'" onload="resizeImage(this, 134, 100)" onclick="window.open(this.src);" />';
        
        //链接
//        var a = document.createElement("a");
//        a.innerHTML = FileInfo.Name;
//        a.alt=FileInfo.Name;
//        
//        var chk = document.createElement("input");
//        chk.type="checkbox";
//        chk.value = ImgPath;
//        chk.onclick = function()
//        {
//            return CViewMgr.sm_viewMgr.ShowCheck(this);
//        }
        
        divImage.appendChild(img);
        divFile.appendChild(divImage);
        //divFile.appendChild(chk);
        //divFile.appendChild(a);
        
        self.appendChild(divFile);
    }
}